<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Move\Controller;

/**
 * Description of CommonController
 *
 * @author gc
 */
class CommonController extends \Think\Controller
{

    public $uid = '';

    protected function _initialize()
    {
        $this->uid = session('user.id');
        if (empty($this->uid)) {// 还没登录 跳转到登录页面
            $this->redirect('Public/login');
        }
    }

    /**
     * 返回json公共函数
     * @param type $status
     * @param type $data
     */
    public function exportJson($status, $data = '', $msg = '')
    {

        $json = array(
            'status' => $status ? 1 : 0,
            'msg' => $msg,
            'data' => $data
        );
        $this->ajaxReturn($json);
        exit;
    }

}
